package com.hzit.listener;

import javax.servlet.annotation.WebListener;
import javax.servlet.http.*;

/**
 * 类名：
 * 作者：WF
 * 功能：
 */
@WebListener
public class MySessionListener implements HttpSessionListener, HttpSessionAttributeListener {
	// session创建时被加载
	@Override
	public void sessionCreated(HttpSessionEvent se) {
		System.out.println("session 创建成功！");
	}
	// session销毁时被销毁
	@Override
	public void sessionDestroyed(HttpSessionEvent se) {
		System.out.println("session 被销毁！");
	}
	// session.setAttribute(): 触发
	@Override
	public void attributeAdded(HttpSessionBindingEvent event) {
		System.out.println("为session添加属性！");
	}
	// session.removeAttribute(): 触发
	@Override
	public void attributeRemoved(HttpSessionBindingEvent event) {
		System.out.println("在session中移除属性！");
	}

	@Override
	public void attributeReplaced(HttpSessionBindingEvent event) {

	}

}
